<template>
  <div class="liteflow-layout">
    <header class="liteflow-layout__toolbar">
      <ToolBar v-if="flowGraph" :flow-graph="flowGraph" :custom-widgets="widgets" />
    </header>
    <div class="liteflow-layout__body">
      <aside class="liteflow-layout__sidebar">
        <SideBar v-if="flowGraph" :flow-graph="flowGraph" />
      </aside>
      <main class="liteflow-layout__canvas">
        <slot />
      </main>
      <section class="liteflow-layout__setting">
        <SettingBar v-if="flowGraph" />
      </section>
    </div>
  </div>
</template>

<script>
import ToolBar from './ToolBar.vue';
import SideBar from './SideBar.vue';
import SettingBar from './SettingBar.vue';

export default {
  name: 'EditorLayout',
  components: {
    ToolBar,
    SideBar,
    SettingBar,
  },
  props: {
    flowGraph: {
      required: false,
      default: null,
    },
    widgets: {
      type: Array,
      default: () => [],
    },
  },
};
</script>

<style lang="less" scoped>
.liteflow-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.liteflow-layout__toolbar {
  flex: 0 0 auto;
  border-bottom: 1px solid #e3e9ef;
  background: #fff;
  z-index: 2;
}

.liteflow-layout__body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  background: #f7f9fc;
}

.liteflow-layout__sidebar {
  flex: 0 0 260px;
  border-right: 1px solid #e3e9ef;
  background: #fff;
  overflow-y: auto;
}

.liteflow-layout__canvas {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
}

.liteflow-layout__setting {
  flex: 0 0 300px;
  border-left: 1px solid #e3e9ef;
  background: #fff;
  overflow-y: auto;
}
</style>

